/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.una.pol.ii.is2.domain.sistema;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "modulo")
@NamedQueries({@NamedQuery(name = "Modulo.findAll", query = "SELECT m FROM Modulo m"), @NamedQuery(name = "Modulo.findByModuCod", query = "SELECT m FROM Modulo m WHERE m.moduCod = :moduCod"), @NamedQuery(name = "Modulo.findByModuDescripcion", query = "SELECT m FROM Modulo m WHERE m.moduDescripcion = :moduDescripcion")})
public class Modulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "modu_cod")
    private String moduCod;
    @Basic(optional = false)
    @Column(name = "modu_descripcion")
    private String moduDescripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pantModulo")
    private Collection<Pantalla> pantallaCollection;

    public Modulo() {
    }

    public Modulo(String moduCod) {
        this.moduCod = moduCod;
    }

    public Modulo(String moduCod, String moduDescripcion) {
        this.moduCod = moduCod;
        this.moduDescripcion = moduDescripcion;
    }

    public String getModuCod() {
        return moduCod;
    }

    public void setModuCod(String moduCod) {
        this.moduCod = moduCod;
    }

    public String getModuDescripcion() {
        return moduDescripcion;
    }

    public void setModuDescripcion(String moduDescripcion) {
        this.moduDescripcion = moduDescripcion;
    }

    public Collection<Pantalla> getPantallaCollection() {
        return pantallaCollection;
    }

    public void setPantallaCollection(Collection<Pantalla> pantallaCollection) {
        this.pantallaCollection = pantallaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (moduCod != null ? moduCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modulo)) {
            return false;
        }
        Modulo other = (Modulo) object;
        if ((this.moduCod == null && other.moduCod != null) || (this.moduCod != null && !this.moduCod.equals(other.moduCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.ii.is2.dao.flota.Modulo[moduCod=" + moduCod + "]";
    }

}
